python find all pairs in list

108

python find all pairs in list -

# importing required ibrary
import itertools
  
  
# declaring a list
lst = [2,2,2]
  
# creating a list of pairs of the list
ordered_list = itertools.permutations(lst,2)
  
print(list(ordered_list))

Comments

Submit
0 Comments